package com.muyu.cloud.system.domain;

import com.muyu.cloud.system.domain.request.BookInfoSaveReq;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @Author: DongZeLiang
 * @date: 2024/5/23
 * @Description: 书籍信息
 * @Version: 1.0
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BookInfo {

    /**
     * 主键
     */
    private Integer id;
    /**
     * 书籍名称
     */
    private String name;
    /**
     * 书籍作者
     */
    private String author;
    /**
     * 价格
     */
    private BigDecimal price;


    public static BookInfo saveReqBuild(BookInfoSaveReq bookInfoSaveReq){
        return BookInfo.builder()
                .name(bookInfoSaveReq.getName())
                .author(bookInfoSaveReq.getAuthor())
                .price(bookInfoSaveReq.getPrice())
                .build();
    }
}
